package com.bzkj.basicinfo.mapper;

import com.bzkj.basicinfo.domain.yxl.YxlBillsInDetailList;
import com.bzkj.basicinfo.domain.yxl.YxlBillsList;
import com.bzkj.basicinfo.domain.yxl.YxlBillsOutDetailList;
import com.bzkj.basicinfo.domain.yxl.YxlPrintDto;
import com.bzkj.basicinfo.domain.yxl.vo.YxlBillsListVo;
import com.bzkj.basicinfo.domain.yxl.vo.YxlExportBillsListVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author：swj
 * @Desc
 * @Date：2025/8/1 8:30
 */
public interface YxlBillsMapper {
    /**
     * 查询出库单据汇总
     *
     * @param entity
     * @return
     */
    List<YxlBillsList> selectOutBillsList(@Param("entity") YxlBillsList entity);
    List<HashMap<String, Object>> selectOutBillsListByBillsId(@Param("billsId") String billsId);
    List<HashMap<String, Object>> selectInBillsListByBillsId(@Param("billsId") String billsId);

    List<YxlBillsList> queryOutBillsList(@Param("entity") YxlPrintDto entity);
    List<YxlExportBillsListVo> exportOutBillsList(@Param("entity") YxlPrintDto entity);


    List<HashMap<String, Object>> queryOutBillsDetailList(@Param("entity") YxlPrintDto entity);

    /**
     * 查询出库单据明细
     *
     * @param billsId
     * @return
     */
    List<YxlBillsOutDetailList> selectOutBillsDetailList(@Param("billsId") String billsId);

    /**
     * 查询入库单据汇总
     *
     * @param entity
     * @return
     */
    List<YxlBillsList> selectInBillsList(@Param("entity")YxlBillsList entity);

    /**
     * 查询入库单据明细
     *
     * @param billsId
     * @return
     */
    List<YxlBillsInDetailList> selectInBillsDetailList(@Param("entity") YxlPrintDto entity);

    YxlBillsList selectOutBillById(@Param("id")String id);

    List<YxlBillsListVo> selectOutBillStoName(@Param("ids")List<String> ids);

    YxlBillsList selectInBillById(@Param("id")String id);

    int updateInBill(YxlPrintDto dto);

    int updateOutBill(YxlPrintDto dto);

    int updateOutBillFlag(YxlPrintDto dto);

    int updateOutBillsFlag(@Param("id")String id,@Param("billsFlag")String billsFlag);

    /**
     * 获取用户管理仓库
     *
     * @return 仓库列表
     */
    List<String> getUserManageWarehouse(Long userId);

    List<HashMap<String, Object>> selectPdaBillsCheck(@Param("stoId") String stoId,@Param("startDate") String startDate,
                                                      @Param("endDate") String endDate,@Param("userName") String userName,
                                                      @Param("billsMode") String billsMode,@Param("billsId") String billsId);
    List<HashMap<String, Object>> selectErpJiXing();

    int cancelCheckById(@Param("id")String id,@Param("modeValue")String modeValue,@Param("billsId")String billsId);

    /**
     * 获取erp收货汇总单数据
     * @return
     */
    List<HashMap<String, Object>> selectErpReceipt(@Param("billsId")String billsId,@Param("ywy")String ywy,
                                                   @Param("startDate")String startDate,@Param("endDate")String endDate);

    /**
     * 查询erp收货明细
     * @param billsId
     * @return
     */
    List<HashMap<String, Object>> selectErpReceiptDetail(@Param("billsId")String billsId);

    HashMap<String, Object> selectErpDrugInfo(@Param("spid")String spid,@Param("pihao")String pihao);

    /**
     * 获取wms收货汇总单数据
     * @return
     */
    List<HashMap<String, Object>> selectWmsReceipt(@Param("billsId")String billsId);

    /**
     * 查询wms收货明细
     * @param billsId
     * @return
     */
    List<HashMap<String, Object>> selectWmsReceiptDetail(@Param("billsId")String billsId,@Param("spid")String spid);

    List<HashMap<String, Object>> selectWmsReceived(@Param("billsId") String billsId,@Param("drugName") String drugName,
                                                    @Param("customer") String customer,@Param("startDate") String startDate,
                                                    @Param("endDate") String endDate); // 可选，如果需要按 SKU 过滤


    /**
     * 插入wms收货主表
     * @param list
     * @return
     */
    int insertWmsReceipt(List<? extends Map<String, Object>> list);

    int insertWmsReceiptLog(List<? extends Map<String, Object>> list);

    /**
     * 插入wms收货明细表
     * @param list
     * @return
     */
    int insertWmsReceiptDetail(List<? extends Map<String, Object>> list);
    /**
     * 更新wms收货明细表
     * @param list
     * @return
     */
    int updateWmsReceiptDetailBatch(List<? extends Map<String, Object>> list);

    /**
     * 查询药品收货详情
     * @param billsId
     * @param drugId
     * @return
     */
    List<HashMap<String, Object>> selectWmsReceiptLog(@Param("billsId")String billsId,@Param("drugId")String drugId);



}
